import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.TextArea;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

public class JAPI_Debugwindow extends Frame implements WindowListener
{
	private static final long serialVersionUID = -2003825257508687340L;
	
	int level=0;
	int zeilen=0;
	Frame frame;
	TextArea text;

	public JAPI_Debugwindow(int l)
	{
		super("JAPI Debug Window");
		setLayout(new BorderLayout());
		text = new TextArea(25,80);
		add(text,"Center");
		pack();
		setlevel(l);
		addWindowListener(this);
	}

	public void setlevel(int l)
	{
		level = l;
		if(level > 0)
			this.setVisible(true);
		else
			this.setVisible(false);
	}

	public void println(String s)
	{
		zeilen++;
		text.append(zeilen+": "+s+"\n");
	}

	public void windowClosing(WindowEvent e)
	{
		System.exit(0);
	}
	public void windowOpened(WindowEvent e)
	{	}
	public void windowClosed(WindowEvent e)
	{	}
	public void windowIconified(WindowEvent e)
	{	}
	public void windowDeiconified(WindowEvent e)
	{	}
	public void windowActivated(WindowEvent e)
	{	}
	public void windowDeactivated(WindowEvent e)
	{	}
}